{extend name="iframe" /}
{block name="body"}
<form action="{:request()->url()}" class="layui-form" method="post">
    <div class="layui-tab" lay-filter="tab-all">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
            <li>履历</li>
            <li>奖惩信息</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label class="layui-form-label">* 姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="scholar_name" value="{$data.scholar_name|default=''}" autocomplete="off" placeholder="请输入学者姓名" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">* 学者编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="kid" value="{$data.kid|default=''}" autocomplete="off" placeholder="请输入学者编号" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">* 机构</label>
                    <div class="layui-input-block">
                        <input type="text" name="institute" value="{$data.institute|default=''}" autocomplete="off" placeholder="请输入机构" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">入职时间</label>
                    <div class="layui-input-block">
                        <input type="text" id="entrant_time" name="entrant_time" value="{$data.entrant_time|default=''}" autocomplete="off" placeholder="请输入入职时间" readonly class="layui-icon-date">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <select name="sex">
                            <!--<option>未知</option>-->
                            <option value="1" {if condition="isset($data) and $data.sex eq 1 or input('sex') eq 1" }selected="selected"{/if}>男</option>
                            <option value="2" {if condition="isset($data) and $data.sex eq 2 or input('sex') eq 2" }selected="selected"{/if}>女</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block">
                        <input type="text" name="email" value="{$data.email|default=''}" autocomplete="off" placeholder="请输入邮箱" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" value="{$data.phone|default=''}" autocomplete="off" placeholder="请输入手机号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">* 职称</label>
                    <div class="layui-input-block">
                        <input type="text" name="professional_title" value="{$data.professional_title|default=''}" autocomplete="off" placeholder="请输入职称" lay-verify="required" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="layui-tab-item">
                <a onclick="resumeAdd()" class="layui-btn"><i class="fa fa-plus-circle"></i> 添加行</a>
                <div id="resumeInfo" class="layui-form-item">
                </div>
            </div>

            <div class="layui-tab-item">
                <a onclick="rewardAndPunishAdd()" class="layui-btn"><i class="fa fa-plus-circle"></i> 添加行</a>
                <div id="rewardAndPunishInfo" class="layui-form-item">
                </div>
            </div>

        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                <button class="layui-btn layui-btn-primary" type="reset">重置</button>
            </div>
        </div>
    </div>
</form>
{/block}
{block name="js"}
    <script>
        layui.use('element', function () {
            var $ = layui.jquery;
            var element = layui.element;
            element.on('tab(tab-all)', function (data) {
                console.log("111")
            })
        })



        function resumeAdd() {
            var div = document.getElementById("resumeInfo");
            var html = document.getElementById("resumeInfo").innerHTML;

            var info = '<div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">开始年份</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="year_from" name="year_from" value="" maxlength="4" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">终止年份</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="year_to" name="year_to" value="" maxlength="4" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">机构</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="agency" name="agency" value="" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">学历</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="education" name="education" value="" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<a onclick="resumeDel(this)" class="layui-btn"><i class="fa fa-plus-circle"></i> 删除行</a>\n' +
                '</div>\n' +
                '</div>';
            div.innerHTML = html + info;
        }

        function resumeDel(e) {
            $(e).parent().parent().remove();
        }

        function rewardAndPunishAdd() {
            var div = document.getElementById("rewardAndPunishInfo");
            var html = document.getElementById("rewardAndPunishInfo").innerHTML;

            var info = '<div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">年份</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="year" name="year" value="" maxlength="4" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<label class="layui-form-label">奖惩信息</label>\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<input type="text" id="rewardAndPunish" name="rewardAndPunish" value="" class="layui-input" lay-verify="required" />\n' +
                '</div>\n' +
                '<div class="layui-inline">\n' +
                '<a onclick="rewardAndPunishDel(this)" class="layui-btn"><i class="fa fa-plus-circle"></i> 删除行</a>\n' +
                '</div>\n' +
                '</div>';
            div.innerHTML = html + info;
        }

        function rewardAndPunishDel(e) {
            $(e).parent().parent().remove();
        }

        laydate.render({
            elem: '#entrant_time',
            type: 'datetime'
        })
    </script>
{/block}
